package com.yupi.yuoj.judge.strategy;

import com.yupi.yuoj.judge.codesanbox.mode.enums.JudgeInfo;
import com.yupi.yuoj.model.entity.QuestionThumb;
import org.springframework.stereotype.Service;

/**
 * 判题管理
 */
@Service
public class JudgeManger {

    /**
     * 执行判题
     *
     * @param judgeContext
     * @return
     */
    public JudgeInfo doJudge(JudgeContext judgeContext) {
        QuestionThumb questionThumb = judgeContext.getQuestionThumb();
        String language = questionThumb.getLanguage();
        JudgeStrategy judgeStrategy = new DefaultJudgeStrategy();
        if ("java".equals(language)) {
            judgeStrategy = new DefaultJudgeStrategy();
        }
        return judgeStrategy.doJudge(judgeContext);
    }

}
